package com.ctgu.fcftsystem.dao;

import com.ctgu.fcftsystem.pojo.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserDao {

    /*分页查询*/
    List<User> findByPaging(int pageCount, int pageSize);

    /**
     * 用户登录
     * @param uid
     * @param upwd
     * @return
     */
    User login(@Param("uid")String uid,@Param("upwd")String upwd);

    /**
     * 注册验证是否存在用户
     * @param uid
     * @return
     */
    User getUserId(@Param("uid")String uid);

    /**
     * 获取user表中所有的用户信息
     */
    List<User> getUserList();

    /**
     * 添加用户
     * @param user
     * @return
     */
    int addUser(@Param("user") User user);

    /**
     * 根据uid删除用户信息
     * @param uid
     * @return
     */
    int delUserById(@Param("uid") String uid);

    /**
     * 更新用户信息
     * @param user
     * @return
     */
    int updateUser(@Param("user") User user);

    /**
     * 任何人修改自己的密码
     * @param uid
     * @param upwd
     * @return
     */
    int updateUserPwd(@Param("uid") String uid,@Param("upwd") String upwd);


    /**
     * 根据一个或多个条件查找用户
     * @param user
     * @return
     */
    List<User> searchUser(@Param("user") User user);

    User getUserMoneyById(@Param("uid")String uid);

    int setUserMoneyById(@Param("uid")String uid,@Param("umoney") int umoney);
}
